/*
 * Write a C++ program to add, subtract, multiply and divide
 * the numbers and display it. Use class and constructor
 * oveloading
 */

# include <iostream>
using namespace std;

class Calculator {
  int a, b;
public:
  Calculator();
  Calculator(int n1, int n2);
  void add();
  void subtract();
  void multiply();
  void divide();
};

Calculator::Calculator() {
  cout << "Default constructor called!" << endl;
  cout << "Intitializing numbers with values 10, 5" << endl;
  a = 10;
  b = 5;
}

Calculator::Calculator(int n1, int n2) {
  cout << "Overloaded constructor called!" << endl;
  cout << "Initiailizing numbers with vaules " << n1 << ", " << n2 << endl;
  a = n1;
  b = n2;
}

void Calculator::add() {
  cout << "Sum of two numbers: " << a + b << endl;
}

void Calculator::subtract() {
  cout << "Difference of two numbers: " << a - b << endl;
}

void Calculator::multiply() {
  cout << "Product of two numbers: " << a * b << endl;
}

void Calculator::divide() {
  cout << "Fraction of two numbers: " << a / b << endl;
}

int main() {
  int n1, n2;
  cout << "Enter first number: ";
  cin >> n1;
  cout << "Enter second number: ";
  cin >> n2;
  Calculator calc1, calc2(n1, n2);
  cout << "Calling the calculator with default constructor..." << endl;
  calc1.add();
  cout << "Calling the calculator with overloader constructor..." << endl;
  calc2.divide();
  return 0;
}
